/*
 * @Author: weisheng
 * @Date: 2023-04-14 12:57:12
 * @LastEditTime: 2023-09-02 22:24:03
 * @LastEditors: weisheng
 * @Description: pinia商店
 * @FilePath: \wot-starter\src\store\index.ts
 * 记得注释
 */
import UserInfo from '@/model/UserInfo'
import { url } from 'inspector'
import { defineStore } from 'pinia'

interface AuthStore {
  // 鉴权令牌
  userInfo: any | null
  useTyz: any | null
  addMerParams: {
    businessLicense: any[]
    openingPermit: any[]
  }
  addCardParams: {
    identityCardReverse: any[]
    identityCardFront: any[]
  }
  addFormParams: {
    merchantType: string
    merchantName: string
    totalRoomNum: string
    merchantPrincipal: string
    merchantAddress: string
    merchantLongitude: number | any
    merchantLatitude: number | any
    businessDistrictId: string
    timeRange: any
    contactNumber: string
    secondContactNumber: string
    userId: string
  }
}
// defineStore 调用后返回一个函数，调用该函数获得 Store 实体
export const useAuthStore = defineStore('authState', {
  // state: 返回对象的函数
  state: (): any => ({
    userInfo: null,
    useTyz: null,
    addMerParams: {
      businessLicense: [],
      openingPermit: []
    },
    addCardParams: {
      identityCardReverse: [],
      identityCardFront: []
    },
    addFormParams: {
      merchantType: '0',
      merchantName: '',
      totalRoomNum: '',
      merchantPrincipal: '',
      merchantAddress: '',
      businessDistrictId: '1591276185086767106',
      timeRange: [],
      contactNumber: '',
      secondContactNumber: '',
      userId: '1792757467626704898',
      merchantLongitude: '',
      merchantLatitude: ''
    },
	actionUrl:'https://admin2.jzshun.com/prod-api/cityAdmin/mall/open/v2/qiniu_single_upload?resetName=true'//上传文件地址
  }),
  getters: {
    getUseTyz(): any {
      return this.useTyz
    }
  },
  actions: {
    logout() {
      this.userInfo = null
    },
    logoutTyz() {
      this.useTyz = '333333'
    }
  }
})
